import { writable, get } from "svelte/store";
import { navigate } from "svelte-routing";
import { user } from "./user";
import { login as apiLogin } from "../api";
import { toast } from "@zerodevx/svelte-toast";
// 登录



// 检查权限
export function hasPermission(routeRoles) {
  if (!routeRoles) return true;

  const currentUser = get(user);
  if (!currentUser) return false;

  return routeRoles.includes(currentUser.role);
}
